// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   DateSelectTag.java

package com.vandagroup.common.taglib.html;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.util.ResponseUtils;

public class DateSelectTag extends TagSupport
{

    protected String name;
    protected String init;
    protected boolean readonly;

    public DateSelectTag()
    {
        name = null;
        init = null;
        readonly = false;
    }

    public String getInit()
    {
        return init;
    }

    public String getName()
    {
        return name;
    }

    public boolean isReadonly()
    {
        return readonly;
    }

    public void setInit(String init)
    {
        this.init = init;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public void setReadonly(boolean readonly)
    {
        this.readonly = readonly;
    }

    public int doStartTag()
        throws JspException
    {
        StringBuffer sb = null;
        if(isReadonly())
        {
            sb = new StringBuffer("<input type=\"text\" name=\"" + name + "\" value=" + (init == null ? "''" : "'" + init + "'") + " readonly style=\"background-color:#D9D9D9\">");
        } else
        {
            sb = new StringBuffer("<script language='javascript'> ");
            sb.append("var " + name + "_DateSelect = new DateSelect('" + name + "', true" + (init == null ? "" : ", '" + init + "'") + ");");
            sb.append(" </script>");
        }
        ResponseUtils.write(pageContext, sb.toString());
        return 1;
    }

    public int doEndTag()
        throws JspException
    {
        return 6;
    }
}
